package 高效制胜._03;

/**
 * @author yzh
 * @version 1.0
 * @date 2021/9/9 12:23
 * 斐波那契数
 * 算法：动态规划
 */
public class _509 {
    static int[] ans = new int[31];
    static {
        ans[0] = 0;
        ans[1] = 1;
        for (int i = 2; i <= 30; i++) ans[i] = ans[i - 2] + ans[i - 1];
    }
    public int fib(int n) {
        return ans[n];
    }
}
